﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using com.woodsoft.core.Files;
using System.ComponentModel;
using EQ1.Elements;
using EQ1.Objects;

namespace EQ1.Templates {
  public class ButtonDrawTemplate : UIClass, IUIElement<ButtonDrawTemplate> {
    public ButtonDrawTemplate ( UIDocument doc , string name )
      : base( doc , name ) {
    }
    public ButtonDrawTemplate ( UIDocument doc )
      : this( doc , "ButtonDrawTemplate" ) {
    }

    #region IUIElement<ButtonDrawTemplate> Members

    public void Copy ( ButtonDrawTemplate val ) {
      base.Copy( val );

      this.Normal = val.Normal;
      this.Pressed = val.Pressed;
      this.Flyby = val.Flyby;
      this.Disabled = val.Disabled;
      this.PressedFlyby = val.PressedFlyby;
      this.PressedDisabled = val.PressedDisabled;
      this.NormalDecal = val.NormalDecal;
      this.PressedDecal = val.PressedDecal;
      this.FlybyDecal = val.FlybyDecal;
      this.DisabledDecal = val.DisabledDecal;
      this.PressedFlybyDecal = val.PressedFlybyDecal;
      this.PressedDisabledDecal = val.PressedDisabledDecal;
    }
    public void Validate ( ButtonDrawTemplate val , string name ) {
      UIClass par = ( UIClass ) this.ParentNode;

      if( val.LocalName != name ) {
        ButtonDrawTemplate el = new ButtonDrawTemplate( ( UIDocument ) val.OwnerDocument , name );
        el.Copy( val );
        val = el;
      }

      if( par.GetElement( name ) != null )
        par.RemoveElement( name );

      par.AppendChild( val );
    }

    #endregion
    
    public string Normal {
      get {
        return this.GetElement( "Normal" ).InnerText;
      }
      set {
        this.Validate( "Normal" , value );
      }
    }
    public string Pressed {
      get {
        return this.GetElement( "Pressed" ).InnerText;
      }
      set {
        this.Validate( "Pressed" , value );
      }
    }
    public string Flyby {
      get {
        return this.GetElement( "Flyby" ).InnerText;
      }
      set {
        this.Validate( "Flyby" , value );
      }
    }
    public string Disabled {
      get {
        return this.GetElement( "Disabled" ).InnerText;
      }
      set {
        this.Validate( "Disabled" , value );
      }
    }
    public string PressedFlyby {
      get {
        return this.GetElement( "PressedFlyby" ).InnerText;
      }
      set {
        this.Validate( "PressedFlyby" , value );
      }
    }
    public string PressedDisabled {
      get {
        return this.GetElement( "PressedDisabled" ).InnerText;
      }
      set {
        this.Validate( "PressedDisabled" , value );
      }
    }
    public string NormalDecal {
      get {
        return this.GetElement( "NormalDecal" ).InnerText;
      }
      set {
        this.Validate( "NormalDecal" , value );
      }
    }
    public string PressedDecal {
      get {
        return this.GetElement( "PressedDecal" ).InnerText;
      }
      set {
        this.Validate( "PressedDecal" , value );
      }
    }
    public string FlybyDecal {
      get {
        return this.GetElement( "FlybyDecal" ).InnerText;
      }
      set {
        this.Validate( "FlybyDecal" , value );
      }
    }
    public string DisabledDecal {
      get {
        return this.GetElement( "DisabledDecal" ).InnerText;
      }
      set {
        this.Validate( "DisabledDecal" , value );
      }
    }
    public string PressedFlybyDecal {
      get {
        return this.GetElement( "PressedFlybyDecal" ).InnerText;
      }
      set {
        this.Validate( "PressedFlybyDecal" , value );
      }
    }
    public string PressedDisabledDecal {
      get {
        return this.GetElement( "PressedDisabledDecal" ).InnerText;
      }
      set {
        this.Validate( "PressedDisabledDecal" , value );
      }
    }


  }
}
